//
//  DirectionalQuestionViewController.h
//  MyProject
//
//  Created by 石小强 on 2018/5/4.
//  Copyright © 2018年 yanjiaming. All rights reserved.
//

#import "MoreAlertVC.h"
#import <Masonry.h>

@interface MoreAlertVC ()

@end

@implementation MoreAlertVC


- (instancetype)initWithIndex:(NSInteger)index;
{
    self = [super init];
    if (self) {
        self.index = index;
        [self createUI];
    }
    return self;
}

- (void)createUI{
    UIView * backView = [[UIView alloc] init];
    [self.view addSubview:backView];
    [backView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(self.view);
    }];
    backView.backgroundColor = [UIColor clearColor];
//    backView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
//    backView.alpha = 0.4;
    UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backViewOnPress)];
    [backView addGestureRecognizer:tap];
    
    
    UIImageView * imgV = [[UIImageView alloc] init];
//    imgV.image = [UIImage imageNamed:@"question_ic_pop"];
    if (self.index == 1) {
        imgV.image = [UIImage imageNamed:@"popup_tip"];
    } else {
        imgV.image = [UIImage imageNamed:@"popup_tip_two"];
    }
    
    [self.view addSubview:imgV];
    
    CGFloat topH = 54;
    if ([Tool isIphoneX]) {
        topH += 20;
    }
    [imgV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(self.view.mas_right).with.mas_offset(-10);
        make.top.mas_equalTo(self.view.mas_top).with.mas_offset(topH);
        make.size.mas_equalTo(CGSizeMake(217, 109));
    }];
    
//    UIEdgeInsets edg = UIEdgeInsetsMake(0, 0, 0, 0);
//    UIImage * img = [[UIImage imageNamed:@"question_ic_pop"] resizableImageWithCapInsets:edg resizingMode:UIImageResizingModeStretch];
//    imgV.image = img;
    
    UILabel *contentL = [[UILabel alloc] init];
    contentL.numberOfLines = 0;
    contentL.text = @"问答每被其他用户付费偷听／看一次你将得到0.5元，72小时未被答复，费将自动退回。";
    contentL.textColor = [UIColor whiteColor];
    contentL.font = [UIFont fontWithName:@"PingFang SC" size:12];
//    [self.view addSubview:contentL];
    
//    [contentL mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.right.mas_equalTo(self.view.mas_right).with.mas_offset(-6);
//        make.top.mas_equalTo(self.view.mas_top).with.mas_offset(64+6);
//        make.size.mas_equalTo(CGSizeMake(217, 109));
//    }];
}

#pragma  mark -- GestureRecognizer
- (void)backViewOnPress
{
    [self.view removeFromSuperview];
}

- (void)viewDidLoad {
    [super viewDidLoad];
}


@end
